﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using zframe;

public class CoordinateTranfer : MonoBehaviour
{
    public Transform container;
    public RectTransform uiEle;   
    public Camera uiCam;
    public Button btn;
    // Start is called before the first frame update
    void Start()
    {
        //btn.onClick.AddListener(CoordinateTran);
        ZLogger.Log("CoordinateTranfer GetJoystickNames=" + string.Join("-", Input.GetJoystickNames()));  
    }

    private void CoordinateTran()
    {
        
    }

    

    // Update is called once per frame
    void Update()
    {
        if (Input.GetButtonUp("Fire1"))
        {
            //屏幕坐标转换成本地坐标
            Vector3 pos = PosTranferUtils.ScreenLocalPosTrans(container, Input.mousePosition, false, uiCam);
            uiEle.anchoredPosition = pos; //ui坐标应该使用 anchoredPosition 去设置
        }
    }
}
